package com.nervenets.template.hibernate.dao;

import com.nervenets.general.hibernate.dao.BaseDao;
import com.nervenets.template.hibernate.domain.user.Manager;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ManagerDao extends BaseDao<Manager> {
    @Query(value = "select id from manager order by id limit 1", nativeQuery = true)
    Long findTop1ManagerIdByOrderById();

    Manager findByMobile(String mobile);

    long countByRoleGroupsIdAndDeleted(Long roleGroups_id, long deleted);

    List<Manager> findAllByRoleGroupsIdAndDeleted(Long roleGroups_id, long deleted);
}
